package com.ruoyi.chargepile.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.chargepile.domain.ChargeConfig;
import com.ruoyi.chargepile.mapper.ChargeConfigMapper;
import com.ruoyi.chargepile.service.ChargeConfigService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 充电配置表 服务实现类
 * </p>
 *
 * @author zxc
 * @since 2024-07-03
 */
@Service
public class ChargeConfigServiceImpl extends ServiceImpl<ChargeConfigMapper, ChargeConfig> implements ChargeConfigService {

    @Resource
    private ChargeConfigMapper chargeConfigMapper;

    @Override
    public boolean initChargeConfig(Long userId) {
        ChargeConfig chargeConfig = new ChargeConfig();
        chargeConfig.setUserId(Math.toIntExact(userId));
        if(chargeConfigMapper.insert(chargeConfig) > 0){
            return true;
        }else{
            return false;
        }
    }
}
